﻿
package system.data;

import java.util.*;

import framework.core.*;
/*
	Author    :Jackey
	CreateTime:2008-03-03 10:13:51
*/
public class SysConfigBase extends Table 
{
public static final String TABLE_NAME = "T_SYS_CONFIG";

private static final String BACKUP_TABLE_NAME = "T_SYS_CONFIG_BACKUP";

private static final String BACKUP_SEQ_NAME = "S_SYS_CONFIG_BACKUP";


public static final String ID = "ID";

public static final String NAME = "NAME";

public static final String VAL = "VAL";

public static final String REMARK = "REMARK";


public static Vector m_fields = null;


private String m_id = ""; //序号

private String m_name = ""; //配置名称

private String m_val = ""; //配置值

private String m_remark = ""; //说明



	public String getId()
	{
	    return m_id;
	}
	public void  setId(String v)
	{
		if(getId().equals(v)) return ;
		m_id = v ;
		markDirty(ID);
	}



	

	public String getName()
	{
	    return m_name;
	}
	public void  setName(String v)
	{
		if(getName().equals(v)) return ;
		m_name = v ;
		markDirty(NAME);
	}



	

	public String getVal()
	{
	    return m_val;
	}
	public void  setVal(String v)
	{
		if(getVal().equals(v)) return ;
		m_val = v ;
		markDirty(VAL);
	}



	

	public String getRemark()
	{
	    return m_remark;
	}
	public void  setRemark(String v)
	{
		if(getRemark().equals(v)) return ;
		m_remark = v ;
		markDirty(REMARK);
	}



	



	public String viewId(DBConnection con) throws Exception
	{
		return Value.view(getId());
	}

	public String viewName(DBConnection con) throws Exception
	{
		return Value.view(getName());
	}

	public String viewVal(DBConnection con) throws Exception
	{
		return Value.view(getVal());
	}

	public String viewRemark(DBConnection con) throws Exception
	{
		return Value.view(getRemark());
	}



protected SysConfigBase()
{
}

public void fill(SysConfigPageData pageData) throws Exception
{

	if(pageData.getId()!=null)
	{	
		setId(pageData.getId());
	}

	if(pageData.getName()!=null)
	{	
		setName(pageData.getName());
	}

	if(pageData.getVal()!=null)
	{	
		setVal(pageData.getVal());
	}

	if(pageData.getRemark()!=null)
	{	
		setRemark(pageData.getRemark());
	}

}

public String getTableName() 
{
	return TABLE_NAME;
}

public String getBackupTableName() 
{
	return BACKUP_TABLE_NAME;
}

public String getBackupSeqName() 
{
	return BACKUP_SEQ_NAME;
}

public java.util.Vector getFields() 
{
	if(m_fields==null)
	{
		m_fields = new Vector();

		m_fields.add(new Field(ID,Value.TYPE_STRING,true,true,32,"序号"));

		m_fields.add(new Field(NAME,Value.TYPE_STRING,false,true,100,"配置名称"));

		m_fields.add(new Field(VAL,Value.TYPE_STRING,false,false,200,"配置值"));

		m_fields.add(new Field(REMARK,Value.TYPE_STRING,false,false,500,"说明"));
		
	}
	return m_fields;
}

public void initObject(java.sql.ResultSet rs) throws Exception
{

	m_id = getString(rs,ID);

	m_name = getString(rs,NAME);

	m_val = getString(rs,VAL);

	m_remark = getString(rs,REMARK);

	ms_new_flag = ConstDefine.NO;
}

public Value get(String f)
{

	if(f.equalsIgnoreCase(ID))
	{
		return new Value(getId());
	}

	if(f.equalsIgnoreCase(NAME))
	{
		return new Value(getName());
	}

	if(f.equalsIgnoreCase(VAL))
	{
		return new Value(getVal());
	}

	if(f.equalsIgnoreCase(REMARK))
	{
		return new Value(getRemark());
	}
	
	return null;
}
public void set(String f,Value v) throws Exception
{

	if(f.equalsIgnoreCase(ID))
	{
		setId(v.getString());
	}

	if(f.equalsIgnoreCase(NAME))
	{
		setName(v.getString());
	}

	if(f.equalsIgnoreCase(VAL))
	{
		setVal(v.getString());
	}

	if(f.equalsIgnoreCase(REMARK))
	{
		setRemark(v.getString());
	}
	
}
public String toString()
{
	String msg = "SysConfig=\n";
	msg += "(\r\n";

	msg += "    序号(id)="+get("id")+"\r\n";

	msg += "    配置名称(name)="+get("name")+"\r\n";

	msg += "    配置值(val)="+get("val")+"\r\n";

	msg += "    说明(remark)="+get("remark")+"\r\n";
		
	msg += ")\r\n";
	return msg;
}
public void copyBase(SysConfigBase srcObj)
{

	setName(srcObj.getName());

	setVal(srcObj.getVal());

	setRemark(srcObj.getRemark());

}

public String toXml() throws Exception
{
	String xml = "";
	xml += "<SysConfig>";

	xml += "<Id>"+Value.view(getId())+"</Id>";

	xml += "<Name>"+Value.view(getName())+"</Name>";

	xml += "<Val>"+Value.view(getVal())+"</Val>";

	xml += "<Remark>"+Value.view(getRemark())+"</Remark>";
	
	xml += "</SysConfig>";
	return xml;
}

}
